package com.tuweiya.study.springboot002.controller;

import com.tuweiya.study.springboot002.bean.StudentBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 读取不是默认配置文件中的属性内容
 *  |- @EnableConfigurationProperties
 */
@RestController
@RequestMapping(value = "/student")
@EnableConfigurationProperties({StudentBean.class})
public class StudentController {

    @Autowired
    StudentBean studentBean;


    /**
     * 读取StudentBean的内容
     */
    @RequestMapping(value = "/readProperties")
    public String readStudentProperties(){
        return studentBean.toString();

    }

}
